package top.laoshuzi.designpatterns.base.behavior.interpreter;

/**
 * 非表达式
 */
public class Not extends Expression {

    private Expression exp;

    public Not(Expression exp) {
        this.exp = exp;
    }

    @Override
    public boolean interpret(Context context) {
        return !exp.interpret(context);
    }

    @Override
    public String toString() {
        return "(Not " + exp.toString() + ")";
    }
}
